# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
  # Renders navigation on the top of the screen that indicates how we
  # reached this page.
  def top_nav(current_title, parts=[], options={})
    options = {:include_root=>true}.merge(options)
    html = []
    if options[:include_root]
      html << link_to(t('collection.all'), collections_path,
        :class=>'previousPage')
    end
    html += parts.map do |part|
      case part
      when Collection
        link_to part.title, collection_path(part), :class=>'previousPage'
      when Section
        link_to part.title, section_path(part), :class=>'previousPage'
      end
    end
    html << "<p class='currentPage'>#{current_title}</p>"
    html.join("<span class='nextArrow'> &gt; </span>")+"<br/>"
  end
  
  def facebook_share_url
    request.url.sub(request.subdomains.first, 'www')
  end

end

